home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Games Collection 1 / software vault.zip / software vault / CDR10 / SPX20.ZIP / SPX_DOC.ZIP / MOUSE.DOC next >
Text File  |  1993-09-27  |  6KB  |  141 lines

  1. { SPX Library Version 2.0  Copyright 1993 Scott D. Ramsay }
  2.  
  3.  The MOUSE unit provides basic routines for reading the mouse inputs.
  4.  
  5. ───────────────────────────────────────────────────────────────────────────
  6. Global Variables:
  7.  
  8.    visible     TRUE if the mouse pointer is visiable.
  9.    mousehere   TRUE is a mouse is connected and the driver is installed
  10.    mousewason  TRUE if the mouse was on before the procedure MOUSEOFF was called
  11.    nomouse     same as MOUSEHERE (for compatability)
  12.    mseshp      SPX default small mouse pointer shape
  13.    skl         horzontal scale factor.  Some mouse drivers set the horzontal
  14.                range in 320x200 mode at 0..639 instead of 0..319. This
  15.                variable can be used to adjust the value. Set by the
  16.                procedure NORMALIZEMX
  17.  
  18.    m1,m2,m3,m4 : integer;  { scratch variables, can use for any purpose }
  19.  
  20. ───────────────────────────────────────────────────────────────────────────
  21. procedure mset(var m1,m2,m3,m4:integer);
  22.  
  23.    For users who are familar with the mouse driver interrupt number, they
  24.    can use this procedure for direct interrupt mouse calls.
  25.  
  26.    m1   = register AX
  27.    m2   = register BX
  28.    m3   = register CX
  29.    m4   = register DX
  30.  
  31. ───────────────────────────────────────────────────────────────────────────
  32. function mousereset:integer;
  33.  
  34.   Resets the mouse.  Must be called first to use any of the other
  35.   functions.  Returns 0 if successful
  36. ───────────────────────────────────────────────────────────────────────────
  37. procedure mouseon;
  38.  
  39.   Turns on the mouse.  (display)
  40. ───────────────────────────────────────────────────────────────────────────
  41. function mouseoff:boolean;
  42.  
  43.   Turns off the mouse.  (hide)
  44. ───────────────────────────────────────────────────────────────────────────
  45. procedure getmouse(var m2,m3,m4:integer);
  46.  
  47.   Gets the mouse inputs
  48.  
  49.   m2  Mouse button mask.  Bit set indicates mouse button is down.
  50.         bit 0 set  -  button 1
  51.         bit 1 set  -  button 2
  52.         bit 2 set  -  button 3
  53.   m3  Mouse current X position
  54.   m4  Mouse current Y position
  55. ───────────────────────────────────────────────────────────────────────────
  56. procedure setmouse(m3,m4:integer);
  57.  
  58.   Move the mouse to a location.
  59.  
  60.   m3,m4   (x,y) position (in pixels) to move the mouse.
  61. ───────────────────────────────────────────────────────────────────────────
  62. procedure getmousepresses(var m2,m3,m4:integer);
  63.  
  64.   Get the number of mouse button presses.  Since last call
  65.  
  66.     m2     number of presses.
  67.     m3,m4  Mouse (x,y) position
  68. ───────────────────────────────────────────────────────────────────────────
  69. procedure getmousereleases(var m2,m3,m4:integer);
  70.  
  71.   Get the number of mouse button releases.  Since last call
  72.  
  73.     m2     number of releases.
  74.     m3,m4  Mouse (x,y) position
  75. ───────────────────────────────────────────────────────────────────────────
  76. procedure getmousemotion(var m3,m4:integer);
  77.  
  78.    Get the mouse motion
  79.  
  80.    m3    mouse horzontal speed.  0 = not moving horzontally
  81.    m4    mouse vertical speed.  0 = not moving vertically
  82. ───────────────────────────────────────────────────────────────────────────
  83. procedure setmousecursor(m2,m3:integer; var mask);
  84.  
  85.    Set the mouse to a new shape.
  86.  
  87.    m2,m3  (x,y) offset of the mouse hot spot.
  88.    mask   64 bytes describing the mouse shape. Maximum size of a cursor is
  89.           32x32.  The first 32 bytes is a bit level mask.  The next 32 bytes
  90.           is the cursor shape.  A bit set in the mask defines transparency. A
  91.           bit set in the cursor shape defines white.
  92.  
  93. ───────────────────────────────────────────────────────────────────────────
  94. procedure setmouseratio(m3,m4:integer);
  95.  
  96.   Set the mouse movement speed.
  97.  
  98.   m3  Set the horzontal speed
  99.   m3  Set the vertical speed
  100. ───────────────────────────────────────────────────────────────────────────
  101. procedure setmouseoff(x1,y1,x2,y2:integer);
  102.  
  103.   Set a rectangular region which the mouse will not be displayed (if on)
  104.  
  105.   x1,y1  top-left position of rectangle
  106.   x2,y2  bottom-right position of rectangle
  107. ───────────────────────────────────────────────────────────────────────────
  108. procedure setmousepage(f:byte);
  109.  
  110.   Sets the visual page of the mouse. (Does not work in 320x200x256 mode)
  111. ───────────────────────────────────────────────────────────────────────────
  112. procedure cleanmouse;
  113.  
  114.   Waits until not mouse button is pressed
  115. ───────────────────────────────────────────────────────────────────────────
  116. procedure chkmouseon;
  117.  
  118.   Displays the mouse if it was turned off by the procedure MOUSEOFF
  119. ───────────────────────────────────────────────────────────────────────────
  120. procedure setdefptr;
  121.  
  122.   Sets the mouse shape to the SPX default cursor arrow
  123. ───────────────────────────────────────────────────────────────────────────
  124. procedure normalizemx;
  125.  
  126.    Sets the SKL variable accoring to the mouse driver width range in
  127.    320x200x256 mode.  Call right after the function mousereset.
  128.    Works only in mode 13h.
  129.  
  130.    example:
  131.  
  132.      openmode(1);               { set to 320x200 mode }
  133.      if mousereset<>0           { reset mouse driver }
  134.        then writeln('No mouse is installed')
  135.        else
  136.          begin
  137.            normalizemx; { set skl variable according to driver }
  138.            getmouse(m2,m3,m4); { get the mouse position }
  139.            y_position := m4;  { vertical position of mouse }
  140.            x_position := m3 div skl; { horzontal position of mouse }
  141.          end;